import pandas as pd

def txt_to_excel(txt_file, excel_file):
    # 读取txt文件内容
    with open(txt_file, 'r') as file:
        lines = file.readlines()

    # 将txt内容转换为DataFrame
    data = {'Text': lines}
    df = pd.DataFrame(data)

    # 将DataFrame保存为Excel文件
    df.to_excel(excel_file, index=False)

# 示例用法
txt_file = 'input.txt'
excel_file = 'output.xlsx'
txt_to_excel(txt_file, excel_file)
